documentalists_sandboxfandomcom-20200216-history
Tutorial
__NOEDITSECTION__ Functional specification This application uses the Table of Contents (ToC) of a top level page to produce for each of its subpages (that is listed in the ToC) zero or more navigation bars with a hyperlink to the previous page and one to the next. If we: The script: change the sequence of the rows of the ToC, ... ... changes the sequence of the lessons to reflect the modified table. ... updates the Previous/Next links to reflect the modified table. insert rows in the ToC, ... ... new lessons appear in the tutorial. ... the "Previous/Next" links of all pages are updated to reflect the modified table. delete rows from the table, ... ... the corresponding lessons disappear from the tutorial. These lessons aren't deleted, they're just no longer linked to. ... the "Previous/Next" links of all pages are updated to reflect the modified table. rename lessons pages and leave a redirect behind (default wiki behavior), ... ... the corresponding lessons have no longer Previous/Next links until the ToC specifies the new names. ... the "Previous/Next" links and the Table of content(ToC) are not updated and shows the old names. If the user clicks an old name, the redirect makes the user land on the new page. When the table is updated the behavior goes back to normal. Interface specification This application works only if all of the conditions in the list below are met. * The Wikia contains one ore more tutorial. * Each tutorial consists of an overview page and one or more lesson pages. * Each overview page contains a table of content. * Each overview page is a root page (not a subpage of another page). * Each lesson is a subpage of its tutorial's overview page. * Each lesson has one or more HTML-div elements with an attribute "class" that has value "Tutorial_previous-next". * A table of content is an HTML-table containing one table row per lesson. * A table of content is an HTML-table with an attribute "id" that has the value "Tutorial-ToC". * The first cell of each row in the table of content contains an hyperlink to the lesson. Design specification * This application is executed when a Wikia page is (re)loaded. * When this application is executed it checks the document's URL. If the URL contains no more "/" after the first occurrence of ".wikia.com/wiki/" the Wikia page is a root page and the execution stops. * Subpage * If the Wikia page is a subpage, the page is searched for HTML-elements with an attribute "class" that has value "Tutorial_previous-next". If none of these are found the execution stops, otherwise the Wikia page is considered to be a lesson and the execution continues. Lesson * In the background the application loads the root page of the lesson, and searches that page for an element with an attribute "id" that has the value "Tutorial-ToC". If such element does not exist the execution stops with an error message otherwise the table is searched for a table row element that has a first cell that contains a hyperlink to this lesson. If such row does not exist the execution stops with an error message otherwise the row above and below are used to create the previous and next links on the lesson page. Demonstration The module is used here. Available versions Version Dependencies Notes development none